/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package client.views;


import client.beans.ServerBean;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.xml.bind.JAXBException;

/**
 *
 * @author efim
 */
@ManagedBean
@SessionScoped
public class AddAccountView
{
    @EJB
    private ServerBean serverBean;
    
    
    private String name;

    /**
     * Get the value of name
     *
     * @return the value of name
     */
    public String getName() {
        return name;
    }

    /**
     * Set the value of name
     *
     * @param name new value of name
     */
    public void setName(String name) {
        this.name = name;
    }

    

    /**
     * Get the value of account
     *
     * @return the value of account
     */
    
    
    /**
     * Creates a new instance of AddAccountView
     */
    public AddAccountView() {
        
    }
    
    
    
    public void postAccount()
    {
        InputStream is = null;
        try {
            Map<String,String> params = new HashMap<>();
            params.put("name", name);
            Object answer = serverBean.queryToServer("CreateAccount", params);            
        } catch (IOException ex) {
            Logger.getLogger(AddTransactionView.class.getName()).log(Level.SEVERE, null, ex);
        } catch (JAXBException ex) {
            Logger.getLogger(AddAccountView.class.getName()).log(Level.SEVERE, null, ex);
        } 
    }
    
    
}
